package com.edwin.tfm;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class phone extends ListActivity {
	    public void onCreate(Bundle savedInstanceState) {
	    	super.onCreate(savedInstanceState);

	    	String[] phones = getResources().getStringArray(R.array.phone_array);
	    	setListAdapter(new ArrayAdapter<String>(this, R.layout.phone, phones));

	    	  ListView l = getListView();
	    	  l.setTextFilterEnabled(true);

	    	  l.setOnItemClickListener(new OnItemClickListener() {
	    	    public void onItemClick(AdapterView<?> parent, View view,
	    	        int position, long id) {
	    	      // When clicked, show a toast with the TextView text
	    	      Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
	    	          Toast.LENGTH_SHORT).show();
	    	    }
	    	  });
	    }
}